Managing logger source code segments

ABSTRACT

A computer-implemented method includes identifying a primary code segment, determining a confidence score associated with said primary code segment, and determining whether the confidence score exceeds a confidence threshold. The computer-implemented method further includes responsive to the confidence score exceeding the confidence threshold, determining a logger code segment associated with the primary code segment. A corresponding computer program product and computer system are also disclosed.

BACKGROUND

The present invention relates generally to the field of source codedevelopment platforms, and more particularly to managing logger sourcecode segments in such platforms.

In source code development platforms, logger source code segments canassist developers in testing the program under development and spottingerrors in source code. Managing logger code segments is important tosuch platforms because unnecessary logger code segments have executioncosts while failure to insert logger source code segments when neededcan harm error detection. Developers and users of source codedevelopment platforms continue to face difficulties with managing loggersource code segments in such platforms.

SUMMARY

A computer-implemented method includes identifying a primary codesegment, determining a confidence score associated with said primarycode segment, and determining whether the confidence score exceeds aconfidence threshold. The computer-implemented method further includesresponsive to the confidence score exceeding the confidence threshold,determining a logger code segment associated with the primary codesegment. A corresponding computer program product and computer systemare also disclosed.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of one embodiment of a computer systemenvironment suitable for operation of a logger code determinationprogram, in accordance with at least one embodiment of the presentinvention.

FIG. 2 is a data flow diagram of a logger code determination program, inaccordance with at least one embodiment of the present invention.

FIG. 3 is a flowchart diagram of a logger code determination program, inaccordance with at least one embodiment of the present invention.

FIG. 4 is a block diagram of a computing apparatus suitable forexecuting a logger code determination program, in accordance with atleast one embodiment of the present invention.

DETAILED DESCRIPTION

FIG. 1 is a block diagram of a computer system environment 100 suitablefor operating a logger code determination program 110, in accordancewith at least one embodiment of the present invention. In the computersystem environment 100 depicted in FIG. 1, the program 110 receivesinformation from a code editing interface 121 and from program dataartefacts 122, and uses those information to determine logger codesegments 150. In at least some embodiments, a code-editing interface 121is any combination of one or more computer components that enable a userand/or an application to write, edit, and/or compile at least one lineof computer program code. In some embodiments, the code-editinginterface 121 is an integrated development environment (IDE). In atleast some embodiments, program data 122 is any combination of one ormore data artefacts that a user and/or an application provides to thelogger code determination program 110 and that assists the program 110in at least one step of its operation. In at least some embodiments, alogger code segment 150 is any code segment that performs at least oneof the following: (1) returns and/or displays the value of a variableand/or a state of a computer program during at least one stage of theprogram execution; and (2) provides at least one information about theoperation and/or execution of a computer program during at least onestage of the program execution. In some embodiments, a logger codesegment determines, returns, and/or displays the value of a variableindicating the state of a computer program during at least one stage ofthe program execution. In some embodiments, a logger code segmentsdetermines, returns, and/or displays at least one value based on a testof a variable indicating the state of a computer program during at leastone stage of the program execution. In at least some embodiments, a codesegment is a combination of one or more computer program codestatements, literals, and/or variables.

FIG. 2 is a data-flow diagram of a logger code determination program110, in accordance with at least one embodiment of the presentinvention. In the embodiment depicted in FIG. 2, the program 110determines the primary code segment 221 based on the informationprovided by the code editing interface 121 and determines a confidencescore 250 associated with the primary code segment 221. In at least someembodiments, a primary code segment 221 is a code segment with respectto which the logger code determination program 110 determines at leastone of the following: (i) whether to determine a logger code segment150; and (ii) a particular logger code segment 150. In at least someembodiments, a confidence score 250 associated with the primary codesegment 221 is an indication of lack of confidence in and/orunreliability of the primary code segment 221 (e.g., derived from one ormore properties associated with the primary code segment 221, includinga user and/or application input about the level of confidence in theprimary code segment 221).

In the embodiment depicted in FIG. 2, the logger code determinationprogram 110 determines a confidence threshold 222 based on the programdata 122. In at least some embodiments, a confidence threshold is acombination of one or more data artefacts that indicates when the valueof confidence score 250 associated with the primary code segment 221 ishigh enough to cause the determination of the logger code segment 150.In the embodiment depicted in FIG. 2, the program 110 determines thelogger code segments 150 associated with the primary code segment 221based on confidence threshold 222 and the confidence score 250associated with the primary code segment 221. In some embodiments, theprogram 110 determines one or more logger code segments 150 if theconfidence score 250 associated with the primary code segment 221exceeds the confidence threshold 222.

FIG. 3 is a flow-chart diagram of a logger code determination program,in accordance with at least one embodiment of the present invention. Atstep 300, the program identifies a primary code segment. At step 301,the program determines a confidence score associated with the primarycode segment. At step 302, the program determines whether a confidencescore exceeds a confidence threshold. At step 303, responsive to theconfidence score exceeding the confidence threshold, the programdetermines a logger code segment associated with the primary codesegment.

In some embodiments, the logger code determination program furthercomprises determining a use frequency indicator associated with theprimary code segment, determining a modification frequency indicatorassociated with the primary code segment, determining a use frequencyindicator being associated with the primary code segment, anddetermining a failure response indicator associated with the primarycode segment. In at least some of those embodiments, determining theconfidence score is performed based on at least one of the use frequencyindicator, the modification frequency indicator, the user confidenceindicator, and the failure response indicator. In some embodiments, theconfidence is determined based on an addition of the use frequencyindicator, the modification frequency indicator, and the user confidenceindicator. In some embodiments, the confidence score is determined basedon a weighed sum of the use the use frequency indicator, themodification frequency indicator, the user confidence indicator, and thefailure response indicator, where each of the use frequency indicator,the modification frequency indicator, the user confidence indicator, andthe failure response indicator is associated with a weight value. Insome embodiments, the confidence score is determined based on astatistical measure (e.g., mean) of at least one of the use frequencyindicator, the modification frequency indicator, the user confidenceindicator, and the failure response indicator.

In at least some embodiments, the use frequency indicator associatedwith the primary code segment is any indication of how many times theprimary code segment has been called and/or referenced by at least onecode segment, computer application, and/or user command within at leastone execution flow and/or time period (e.g., an indication of how manytimes a method or function has been called within its namespace codesegment). In at least some embodiments, the modification frequencyindicator associated with the primary code segment is any indication ofhow many times the primary code segment has been modified (eitherdirectly, through modification of another code segment that the primarysegment calls and/or references, or both) within at least one executionflow and/or time period. In at least some embodiments, a user confidenceindicator associated with the primary code segment is any user-suppliedand/or application-supplied indication of confidence in the primary codesegment within at least one time period. In at least some embodiments,the failure response indicator associated with the primary code segmentis an indication of a determination and/or estimation about whether theat least part of the primary code segment has been inserted in responseto a determined and/or response code execution failure (e.g., bug,segmentation error, or other exception). In some embodiments, the loggercode determination program only determines a logger source codeassociated with a primary code segment when the primary code segment hasbeen inserted in response to a source code execution failure (e.g., alogger is inserted for a method that has been modified in the course ofthe response to any failure that occurred).

In some embodiments, the logger code determination program determines acall frequency indicator associated with a primary code segment and achange frequency indicator associated with the primary code segment. Inat least some of those embodiments, determining the use frequencyindicator is performed based on the call frequency indicator anddetermining the modification frequency indicator is performed based onthe change frequency indicator. In at least some embodiments, a callfrequency indicator is an indication of how many times a function,method, and/or subroutine has been called within at least one executionflow and/or time period. In at least some embodiments, a changefrequency indicator is an indication of how many times a code segmenthas been modified within at least one execution flow and/or time period.

In some embodiments, the logger code determination program furthercomprises identifying a normalization guideline. In at least some ofthose embodiments, the use frequency indicator, the modificationfrequency indicator, and the user confidence indicator are eachdetermined based on the normalization guideline. In at least someembodiments, a normalization guideline comprises one or moreinstructions about how one or more values should be modified (e.g., toreflect a meaningful proportionality with one another).

In some embodiments, the logger code determination program furthercomprises determining a stability indicator associated with the primarycode segment and determining whether to remove the logger code segmentbased on the stability indicator. In some embodiments, the programfurther comprises determining a change history indicator associated withthe primary code segment and determining an error history indicatorassociated with the primary code segment. In at least some of thoseembodiment, determining the stability indicator is performed based on atleast one of the change history indicator and the error historyindicator.

In at least some embodiments, a stability indicator associated with theprimary code segment is any indication of how stable the primary codesegment is determined and/or estimated to be. In at least someembodiments, the change history indicator associated with the primarycode segment is any indication of how many times the primary codesegment has been modified (either directly, through modification ofanother code segment that the primary segment calls and/or references,or both) within at least one execution flow and/or time period. In someembodiments, the stability indicator associated with the primary codesegment is the modification frequency indicator associated with theprimary code segment used to determine the confidence score, while inother embodiments the two values may indicate the quantity ofmodification with respect to different execution flows and/or timeperiods. In at least some embodiments, an error history indicatorassociated with a primary code segment is any indication of how manyerrors (e.g., associated with a particular failure response) occurredwithin at least one execution flow and/or time period, where the errorswere determined and/or estimated to be at least in part rooted in theprimary code segment. In some embodiments, the logger code determinationprogram determines whether to insert a logger code segment based on atleast one of the use frequency indicator, the modification frequencyindicator, the user confidence indicator, and the failure responseindicator. In some embodiments, at least one of the use frequencyindicator, the modification frequency indicator, the user confidenceindicator, and the failure response indicator associated with theprimary code segment is determined as a relative value in relation touse frequency, modification frequency, use frequency, and failureresponse of one or more other code segments (such as one or more codesegments within the namespace of the primary code segment).

Embodiments of the present invention enable insertion and removal oflogger code segments based on dynamically determined properties of thesource code file. As such, embodiments of the present invention enableinsertion and removal of logger code segments without the need forexcessive user intervention and/or execution inefficiencies associatedwith user-managed logger code insertion and deletion. Nevertheless, theaforementioned advantages are not required to be present in all of theembodiments of the invention and may not be present in all of theembodiments of the invention.

FIG. 4 is a block diagram depicting components of a computer 400suitable for executing the logger code determination program. FIG. 4displays the computer 400, the one or more processor(s) 404 (includingone or more computer processors), the communications fabric 402, thememory 406, the RAM, the cache 416, the persistent storage 408, thecommunications unit 410, the I/O interfaces 412, the display 420, andthe external devices 418. It should be appreciated that FIG. 4 providesonly an illustration of one embodiment and does not imply anylimitations with regard to the environments in which differentembodiments may be implemented. Many modifications to the depictedenvironment may be made.

As depicted, the computer 400 operates over a communications fabric 402,which provides communications between the cache 416, the computerprocessor(s) 404, the memory 406, the persistent storage 408, thecommunications unit 410, and the input/output (I/O) interface(s) 412.The communications fabric 402 may be implemented with any architecturesuitable for passing data and/or control information between theprocessors 404 (e.g., microprocessors, communications processors, andnetwork processors, etc.), the memory 406, the external devices 418, andany other hardware components within a system. For example, thecommunications fabric 402 may be implemented with one or more buses or acrossbar switch.

The memory 406 and persistent storage 408 are computer readable storagemedia. In the depicted embodiment, the memory 406 includes a randomaccess memory (RAM). In general, the memory 406 may include any suitablevolatile or non-volatile implementations of one or more computerreadable storage media. The cache 416 is a fast memory that enhances theperformance of computer processor(s) 404 by holding recently accesseddata, and data near accessed data, from memory 406.

Program instructions for the logger code determination program may bestored in the persistent storage 408 or in memory 406, or moregenerally, any computer readable storage media, for execution by one ormore of the respective computer processors 404 via the cache 416. Thepersistent storage 408 may include a magnetic hard disk drive.Alternatively, or in addition to a magnetic hard disk drive, thepersistent storage 408 may include, a solid state hard disk drive, asemiconductor storage device, read-only memory (ROM), electronicallyerasable programmable read-only memory (EEPROM), flash memory, or anyother computer readable storage media that is capable of storing programinstructions or digital information.

The media used by the persistent storage 408 may also be removable. Forexample, a removable hard drive may be used for persistent storage 408.Other examples include optical and magnetic disks, thumb drives, andsmart cards that are inserted into a drive for transfer onto anothercomputer readable storage medium that is also part of the persistentstorage 408.

The communications unit 410, in these examples, provides forcommunications with other data processing systems or devices. In theseexamples, the communications unit 410 may include one or more networkinterface cards. The communications unit 410 may provide communicationsthrough the use of either or both physical and wireless communicationslinks. The logger code determination program may be downloaded to thepersistent storage 408 through the communications unit 410. In thecontext of some embodiments of the present invention, the source of thevarious input data may be physically remote to the computer 400 suchthat the input data may be received and the output similarly transmittedvia the communications unit 410.

The I/O interface(s) 412 allows for input and output of data with otherdevices that may operate in conjunction with the computer 400. Forexample, the I/O interface 412 may provide a connection to the externaldevices 418, which may include a keyboard, keypad, a touch screen,and/or some other suitable input devices. External devices 418 may alsoinclude portable computer readable storage media, for example, thumbdrives, portable optical or magnetic disks, and memory cards. Softwareand data used to practice embodiments of the present invention may bestored on such portable computer readable storage media and may beloaded onto the persistent storage 408 via the I/O interface(s) 412. TheI/O interface(s) 412 may similarly connect to a display 420. The display420 provides a mechanism to display data to a user and may be, forexample, a computer monitor.

The programs described herein are identified based upon the applicationfor which they are implemented in a specific embodiment of theinvention. However, it should be appreciated that any particular programnomenclature herein is used merely for convenience, and thus theinvention should not be limited to use solely in any specificapplication identified and/or implied by such nomenclature.

The present invention may be a system, a method, and/or a computerprogram product at any possible technical detail level of integration.The computer program product may include a computer readable storagemedium (or media) having computer readable program instructions thereonfor causing a processor to carry out aspects of the present invention.

The computer readable storage medium can be a tangible device that canretain and store instructions for use by an instruction executiondevice. The computer readable storage medium may be, for example, but isnot limited to, an electronic storage device, a magnetic storage device,an optical storage device, an electromagnetic storage device, asemiconductor storage device, or any suitable combination of theforegoing. A non-exhaustive list of more specific examples of thecomputer readable storage medium includes the following: a portablecomputer diskette, a hard disk, a random access memory (RAM), aread-only memory (ROM), an erasable programmable read-only memory (EPROMor Flash memory), a static random access memory (SRAM), a portablecompact disc read-only memory (CD-ROM), a digital versatile disk (DVD),a memory stick, a floppy disk, a mechanically encoded device such aspunch-cards or raised structures in a groove having instructionsrecorded thereon, and any suitable combination of the foregoing. Acomputer readable storage medium, as used herein, is not to be construedas being transitory signals per se, such as radio waves or other freelypropagating electromagnetic waves, electromagnetic waves propagatingthrough a waveguide or other transmission media (e.g., light pulsespassing through a fiber-optic cable), or electrical signals transmittedthrough a wire.

Computer readable program instructions described herein can bedownloaded to respective computing/processing devices from a computerreadable storage medium or to an external computer or external storagedevice via a network, for example, the Internet, a local area network, awide area network and/or a wireless network. The network may comprisecopper transmission cables, optical transmission fibers, wirelesstransmission, routers, firewalls, switches, gateway computers and/oredge servers. A network adapter card or network interface in eachcomputing/processing device receives computer readable programinstructions from the network and forwards the computer readable programinstructions for storage in a computer readable storage medium withinthe respective computing/processing device.

Computer readable program instructions for carrying out operations ofthe present invention may be assembler instructions,instruction-set-architecture (ISA) instructions, machine instructions,machine dependent instructions, microcode, firmware instructions,state-setting data, configuration data for integrated circuitry, oreither source code or object code written in any combination of one ormore programming languages, including an object oriented programminglanguage such as Smalltalk, C++, or the like, and procedural programminglanguages, such as the “C” programming language or similar programminglanguages. The computer readable program instructions may executeentirely on the user's computer, partly on the user's computer, as astand-alone software package, partly on the user's computer and partlyon a remote computer or entirely on the remote computer or server. Inthe latter scenario, the remote computer may be connected to the user'scomputer through any type of network, including a local area network(LAN) or a wide area network (WAN), or the connection may be made to anexternal computer (for example, through the Internet using an InternetService Provider). In some embodiments, electronic circuitry including,for example, programmable logic circuitry, field-programmable gatearrays (FPGA), or programmable logic arrays (PLA) may execute thecomputer readable program instructions by utilizing state information ofthe computer readable program instructions to personalize the electroniccircuitry, in order to perform aspects of the present invention.

Aspects of the present invention are described herein with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems), and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer readable program instructions.

These computer readable program instructions may be provided to aprocessor of a general purpose computer, special purpose computer, orother programmable data processing apparatus to produce a machine, suchthat the instructions, which execute via the processor of the computeror other programmable data processing apparatus, create means forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks. These computer readable program instructionsmay also be stored in a computer readable storage medium that can directa computer, a programmable data processing apparatus, and/or otherdevices to function in a particular manner, such that the computerreadable storage medium having instructions stored therein comprises anarticle of manufacture including instructions which implement aspects ofthe function/act specified in the flowchart and/or block diagram blockor blocks.

The computer readable program instructions may also be loaded onto acomputer, other programmable data processing apparatus, or other deviceto cause a series of operational steps to be performed on the computer,other programmable apparatus or other device to produce a computerimplemented process, such that the instructions which execute on thecomputer, other programmable apparatus, or other device implement thefunctions/acts specified in the flowchart and/or block diagram block orblocks.

The flowchart and block diagrams in the Figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods, and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof instructions, which comprises one or more executable instructions forimplementing the specified logical function(s). In some alternativeimplementations, the functions noted in the blocks may occur out of theorder noted in the Figures. For example, two blocks shown in successionmay, in fact, be executed substantially concurrently, or the blocks maysometimes be executed in the reverse order, depending upon thefunctionality involved. It will also be noted that each block of theblock diagrams and/or flowchart illustration, and combinations of blocksin the block diagrams and/or flowchart illustration, can be implementedby special purpose hardware-based systems that perform the specifiedfunctions or acts or carry out combinations of special purpose hardwareand computer instructions.

What is claimed is:
 1. A computer-implemented method comprising:identifying a primary code segment; determining a call frequencyindicator, said call frequency indicator being associated with saidprimary code segment; determining a change frequency indicator, saidchange frequency indicator being associated with said primary codesegment; identifying a normalization guideline; determining a usefrequency indicator, said use frequency indicator being associated withsaid primary code segment, wherein determining said use frequencyindicator is performed based on said call frequency indicator and saidnormalization guideline; determining a modification frequency indicator,said modification frequency indicator being associated with said primarycode segment, wherein determining said modification frequency indicatoris performed based on said change frequency indicator and saidnormalization guide; determining a user confidence indicator, said userconfidence indicator being associated with said primary code segment,wherein determining said user confidence indicator is performed based onsaid normalization guideline; determining a failure response indicator,said user confidence indicator being associated with said primary codesegment; determining a confidence score, said confidence score beingassociated with said primary code segment, wherein determining saidconfidence score is performed based on an addition of said use frequencyindicator, said modification frequency indicator, said user confidenceindicator, and said failure response indicator; determining whether saidconfidence score exceeds a confidence threshold; responsive to saidconfidence score exceeding said confidence threshold, determining alogger code segment, said logger code segment being associated with saidprimary code segment; determining a change history indicator, saidchange history indicator being associated with said primary codesegment; determining an error history indicator, said error historyindicator being associated with said primary code segment; determining astability indicator, said stability indicator associated with saidprimary code segment, wherein determining said stability indicator isperformed based on said change history indicator and said error historyindicator; and determining whether to remove said logger code segmentbased on said stability indicator.